import { nullDisplay } from '../utils'
export default {
  props: {
    value: [String, Number, Array, Object],
    options: Object
  },
  render(h) {
    if (this.value === null || this.value === this.options.nullValue) {
      return nullDisplay(h, this.options)
    }
    const props = Object.assign(
      {
        size: 'mini',
        type: ''
      },
      this.options
    )
    var array = []
    if (this.value instanceof Array) {
      array = array.concat(this.value)
    } else if (this.value instanceof Object) {
      for (const i in this.value) {
        array.push(this.value[i])
      }
    } else {
      array.push(this.value)
    }
    return h(
      'div',
      array.map(item => {
        return h(
          'el-tag',
          {
            props: props
          },
          item
        )
      })
    )
  }
}
